<?php
/**
 *
 * @authors  Ysg (y.shi.guo@gmail.com)
 * @website  http://ysg.bonza.cn
 * @date     2017-08-10 11:46:11
 */
namespace Factory;

class App
{

    function __construct()
    {

    }
    public function init()
    {
		if (!defined('ROOT_PATH')) {
			define("ROOT_PATH",realpath('.'));
		}

    }
    static public function run()
    {


    }
}

//暴力自动加载
/*spl_autoload_register(function ($classname){
	$color = ['blue','color','colorfactory','green','red'];
	$shape = ['shape','circle','shapefactory','square','rectangle'];
	if(in_array(strtolower($classname),$color)){
		require(ROOT_PATH.DIRECTORY_SEPARATOR.'color'.DIRECTORY_SEPARATOR.$classname.'.php');
	}elseif(in_array(strtolower($classname),$shape)){
		require(ROOT_PATH.DIRECTORY_SEPARATOR.'shape'.DIRECTORY_SEPARATOR.$classname.'.php');
	}else{
		require(ROOT_PATH.DIRECTORY_SEPARATOR.$classname.'.php');
	}
});*/
/*spl_autoload_register(function ($classname){
	// echo dirname(ROOT_PATH);die;
	// echo (ROOT_PATH).DIRECTORY_SEPARATOR.$classname.'.php';
	require(dirname(ROOT_PATH).DIRECTORY_SEPARATOR.$classname.'.php');
});*/
require 'Autoload.php';
spl_autoload_register('\Factory\Autoload::run');

FactoryProducer::getFactory('hello');
/*function M($str){
	return Factory::getShape($str);
}
function C($str1){
	return Factory::getColor($str1);
}*/

// $facpro = new FactoryProducer();
// $facpro =FactoryProducer::getFactory();
/*\factory\FactoryProducer::getFactory('\factory\shape\ShapeFactory')->getShape('\factory\shape\square')->draw();
\factory\FactoryProducer::getFactory('\factory\color\ColorFactory')->getColor('\factory\color\red')->fill();*/
